<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<div class="box m">
	<div class="btitle path">
		<a href="goHomePage.html"><spring:message code="top.header.homepage" /></a>&nbsp;»&nbsp; <a><spring:message code="page.header.viewcart" /></a>
	</div>
	<div class="bCt productLs">
		<div class="m3" style="padding-left: 0px;">
			<div class="clearfix">
				<div class="roundBoxBody">
					<div class="text-main" style="padding-top: 20px; padding-bottom: 20px;">
						<table class="cart" cellpadding="5" cellspacing="1">
							<tbody>
								<tr>
									<th width="35"><spring:message code="cart.item" /></th>
									<th width="200"><spring:message code="cart.product.name" /></th>
									<th width="60"><spring:message code="cart.product.image" /></th>
									<th width="70"><spring:message code="cart.product.quantity" /></th>
									<th width="130"><spring:message code="cart.product.unit.price" /></th>
									<th width="130"><spring:message code="cart.product.total.price" /></th>
									<th width="80"><spring:message code="cart.action" /></th>
								</tr>
								<c:choose>
									<c:when test="${sessionScope.CART_SESSION == null }">
										<tr>
											<td colspan="7"><spring:message code="cart.empty" /></td>
										</tr>
									</c:when>
									<c:otherwise>
										<c:forEach var="p" items="${sessionScope.CART_SESSION.products}" varStatus="i">
											<tr>
												<td align="center"><c:out value="${i.index +1}" /></td>
												<td style="padding-left: 5px;"><c:out value='${p.name}' /></td>
												<td align="center"><img style="max-height: 50px;" src="loadImage.html?type=THUMB&fileId=${p.productImages[0]}" width="50"></td>
												<td class="tal"><input style="width: 50px;" name="quantity" value="${p.quantity }" type="text" maxlength="4"></td>
												<td class="tal"><font color="red">${p.getUnitPriceAsSale()}</font></td>
												<td class="tal"><font color="red">${p.getTotalPriceAsSale()}</font></td>
												<td class="tal"><a onclick="updateItemCart(${p.id});" ><img src="<c:url value='/images/refresh.png'/>"
														style="margin-top: 12px; border: 0;" align="top"></a>
												<a href="javascript:deleteItemCart(${p.id});"><img src="<c:url value='/images/cross.png'/>" style="margin-top: 12px; border: 0;" align="top"></a>
												</td>
											</tr>
										</c:forEach>
									</c:otherwise>
								</c:choose>

							</tbody>
						</table>
						<div class="clear"></div>
						<c:if test="${sessionScope.CART_SESSION != null }">
							<div style="float: left; padding-top: 15px; padding-right: 20px;">
								<a href="goProducts.html" onclick=""><input value="<spring:message code="cart.continue" />" type="button"></a>
							</div>
							<div style="float: left; padding-top: 15px;">
								<a href="checkOut.html"><input value="<spring:message code="cart.action" />" type="button"></a>
							</div>
						</c:if>
					</div>
				</div>
			</div>
			<div class="clearfix"></div>
		</div>
	</div>
</div>
